using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LogisticsAndong.Entity;
using LogisticsAndong.Model;
using LogisticsAndong.Service;
using Leeder.Business;

namespace LogisticsAndong.Business
{
    /// <summary>
    /// 
    /// </summary>
   public class SystemDeviceMonitorBLL : BaseBLL<SystemDeviceMonitorModel, SystemDeviceMonitorService>
   {
        public SystemDeviceMonitorBLL()
        {
            Service = new SystemDeviceMonitorService();
        }

        public List<SystemDeviceMonitorModel> GetModelList()
        {
            return Service.Query(p => p.IsPhantom == 0).ActivedObj;
        }

        public List<SystemDeviceMonitorModel> GetModelListByCondition(DateTime startDate, DateTime endDate, string deviceType)
        {
            if (string.IsNullOrEmpty(deviceType))
                return Service.Query(p => p.ExceptionDate >= startDate && p.ExceptionDate <= endDate).ActivedObj;
            else
                return Service.Query(p => p.ExceptionDate >= startDate && p.ExceptionDate <= endDate && p.DeviceName == deviceType).ActivedObj;
        }
    }
}
